Release 10.1A: OpenEdge Development:
Programming Interfaces
Managing application user IDs in n-tier applications
An application user ID exists essentially to specify a single user identity that is shared between client and AppServer sessions of an n-tier application. The application user ID typically originates from the client and is used to set the Progress session ID in each AppServer session. It might also be used for synchronizing database connection IDs in each AppServer session, as appropriate.
In n-tier applications, the problem of managing application user IDs consists of two main issues:
- How to transport the application user ID between the AppServer session and a client session.
Note: For information on AppServer operating modes and how AppServer and client sessions interact with them, see OpenEdge Application Server: Developing AppServer Applications .- How to share a single login for an application user ID across multiple requests to an AppServer running in stateless or state-free operating mode.
So, when running in stateless or state-free operating mode, an AppServer must:
- Authenticate the user’s identity once per client connection (stateless) or once per client login (state-free).
- Share a single client-principal object in a common user context storage to assert the user’s identity on each agent involved in a given client’s requests.
- Logout and destroy copies of the client-principal object when the client disconnects (stateless) or logs out (state-free).
In OpenEdge, the basic mechanism for managing user identities is the client-principal object. Typically, in an n-tier application, the AppServer’s 4GL code creates and maintains the client-principal object on behalf of the client and exchanges identity information, based on the operating mode, as described in Table 2–6.
Initializing a client-principal object for an n-tier application
The following code fragment shows how you might initialize a client-principal object to account for the type of Progress session environment it is used in:
For any of the session-managed operating modes, the fragment sets the
SESSION-IDattribute to theSERVER-CONNECTION-IDattribute on theSESSIONsystem handle. This value uniquely identifies the client connection for a given AppServer session and is especially useful for an AppServer session running in stateless operating mode. Since a stateless application service can identify each request by the client connection, it can use this client connection identifier for the client-principal object that represents a client identity. However, for stateless auditing purposes, you might also use theSERVER-CONNECTION-IDvalue to key references to a shared client-principal object, but set theSESSION-IDattribute to a universal unique identifier (UUI) using the 4GLGENERATE-UUIDfunction. This value ensures that a unique client login session auditing record across all possible AppServer sessions.For a state-free AppServer operating mode, the fragment sets the
SESSION-IDattribute on the client-principal object to a universal unique identifier (UUID), which is generated using the 4GLGENERATE-UUIDfunction and encoded as Base64 using the 4GLBASE64-ENCODEfunction. For more information on these functions, see the "Creating and managing unique object identities" section. Since clients of a state-free AppServer make no connections to the AppServer, the application service needs to maintain its own unique identifiers for the client-principal objects that represent client identities.Both stateless and state-free application services must manage user context in order to export, store, retrieve, and import different client-principal objects between client requests, but they must do it differently according to their respective session-managed and session-free behavior.
Managing user identities for a stateless application service
In a stateless application service, the process of managing user identities is somewhat simplified by the existence of client connections. Following is a typical procedure for managing stateless user identities.
![]()
To manage users identities for a stateless application service, you can do the following:
- In the AppServer’s configured startup procedure, build any required application trusted domain registry and remove any client-principal objects from a previous user context left-over from any abnormal session termination.
- In the application service’s login procedure:
- Initialize and seal the client-principal object using a UUID (to uniquely set any auditing context) as the value for the
SESSION-IDattribute on the client-principal object.- Export the client-principal object.
- Store the exported
RAWvalue of the client-principal object in a context database keyed on theSESSION:SERVER-CONNECTION-IDattribute value.For example:
- In the AppServer’s configured activation procedure:
- Lookup the exported client-principal object in the context database using the
SESSION:SERVER-CONNECTION-IDvalue as the lookup key.- Import the client principal object.
- Validate the imported client-principal seal, and use the validated client principal object to set the user identity.
For example:
- In all non-login procedures for the application service, verify that the user identity is valid from activation procedure, and if it is, perform the specified application service task. For example:
- In the AppServer’s configured deactivation procedure, clear the Progress session ID for the next user. For example:
- In the application service’s logout procedure:
- Lookup the exported client-principal object in the context database using the
SESSION:SERVER-CONNECTION-IDvalue as the lookup key.Note: The client-principal object is already imported using the activation procedure and its identity will be cleared using the deactivation procedure.- Remove the exported client-principal object from the context database.
For example:
- In the AppServer’s configured shutdown procedure, empty the user context database. For example:
Managing user identities for a state-free application service
In a state-free application service, the process of managing user identities is somewhat complicated by the lack of any client connections. This requires the application service to manage user identities independently of any physical client identity and to provide a means to exchange the client’s identity with the application service on every client request. Note that for a state-free AppServer, there are no configurable activation and deactivation procedures. So, all the work of establishing and clearing user identities for a given client request must be done for each and every service call by the application service itself. Following is a typical procedure for managing state-free user identities.
![]()
To manage users identities for a state-free application service, you can do the following:
- In the AppServer’s configured startup procedure, build any required application trusted domain registry and remove any client-principal objects from a previous user context left-over from any abnormal session termination.
- In the application service’s login procedure:
- Initialize and seal the client-principal object using a UUID to set a unique value for the
SESSION-IDattribute on the client-principal object.- Export the client-principal object.
- Store the exported
RAWvalue of the client-principal object in a context database keyed on theSESSION-IDattribute value.- Return the
SESSION-IDattribute value as an output parameter to the client.For example:
- In all non-login procedures for the application service:
- Pass in security token as input parameter.
- Lookup the exported client-principal object in the context database using the security token value as the lookup key.
- Import the client principal object.
- Validate the imported client-principal seal, and use the validated client principal object to set the user identity.
- Perform application service task.
- Clear the Progress session ID for the next user.
For example:
- In the application service’s logout procedure:
- In the AppServer’s configured shutdown procedure, empty the user context database. For example:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |